package cn.lzwei.bilimall.product.entity;

import cn.lzwei.common.valid.ListValue;
import cn.lzwei.common.valid.SaveGroup;
import cn.lzwei.common.valid.UpdateGroup;
import cn.lzwei.common.valid.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author lizewei
 * @email Lizewei2105@163.com
 * @date 2022-12-21 15:39:39
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改时品牌id不能为空",groups = {UpdateGroup.class, UpdateStatusGroup.class})
	@Null(message = "新增品牌时id必须为空",groups = {SaveGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名称至少包含一个非空字符",groups = {UpdateGroup.class,SaveGroup.class})
	@Null(message = "修改状态时品牌名必须为空",groups = {UpdateStatusGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotEmpty(message = "品牌logo地址",groups = {UpdateGroup.class,SaveGroup.class})
	@URL(message = "品牌logo地址必须是标准的url地址",groups = {UpdateGroup.class,SaveGroup.class})
	@Null(message = "修改状态时品牌logo地址必须为空",groups = {UpdateStatusGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@Null(message = "修改状态时介绍必须为空",groups = {UpdateStatusGroup.class})
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(value={1,0},groups = {UpdateStatusGroup.class})
	@NotNull(message = "显示状态必须非空",groups = {UpdateGroup.class,SaveGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(message = "首字母非空",groups = {UpdateGroup.class,SaveGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "首字母必须是a-z或A-Z",groups = {UpdateGroup.class,SaveGroup.class})
	@Null(message = "修改状态时首字母必须为空",groups = {UpdateStatusGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序非空",groups = {UpdateGroup.class,SaveGroup.class})
	@Min(message = "排序字段必须非空且大于等于0",value = 0,groups = {UpdateGroup.class,SaveGroup.class})
	@Null(message = "修改状态时排序必须为空",groups = {UpdateStatusGroup.class})
	private Integer sort;

}
